<template>
  <div class="dashboard-container">
    <el-row :gutter="20">
      <el-col :span="8">
        <el-card class="dashboard-card">
          <template #header>
            <div class="card-header">
              <span>今日数据概览</span>
            </div>
          </template>
          <div class="card-content">
            <div class="stat-item">
              <div class="stat-label">数据总量</div>
              <div class="stat-value">12,345</div>
            </div>
            <div class="stat-item">
              <div class="stat-label">处理成功率</div>
              <div class="stat-value">98.5%</div>
            </div>
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="8">
        <el-card class="dashboard-card">
          <template #header>
            <div class="card-header">
              <span>渠道状态</span>
            </div>
          </template>
          <div class="card-content">
            <div class="stat-item">
              <div class="stat-label">上游渠道</div>
              <div class="stat-value">8/10</div>
            </div>
            <div class="stat-item">
              <div class="stat-label">下游渠道</div>
              <div class="stat-value">15/18</div>
            </div>
          </div>
        </el-card>
      </el-col>
      
      <el-col :span="8">
        <el-card class="dashboard-card">
          <template #header>
            <div class="card-header">
              <span>系统状态</span>
            </div>
          </template>
          <div class="card-content">
            <div class="stat-item">
              <div class="stat-label">CPU使用率</div>
              <div class="stat-value">45%</div>
            </div>
            <div class="stat-item">
              <div class="stat-label">内存使用率</div>
              <div class="stat-value">62%</div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
    
    <el-row :gutter="20" style="margin-top: 20px;">
      <el-col :span="12">
        <el-card>
          <template #header>
            <div class="card-header">
              <span>最近操作</span>
            </div>
          </template>
          <el-timeline>
            <el-timeline-item timestamp="2024-01-15 10:30" type="primary">
              创建新的分发方案
            </el-timeline-item>
            <el-timeline-item timestamp="2024-01-15 09:15" type="success">
              上游渠道配置更新
            </el-timeline-item>
            <el-timeline-item timestamp="2024-01-14 16:45" type="info">
              数据验证规则调整
            </el-timeline-item>
          </el-timeline>
        </el-card>
      </el-col>
      
      <el-col :span="12">
        <el-card>
          <template #header>
            <div class="card-header">
              <span>快速入口</span>
            </div>
          </template>
          <div class="quick-links">
            <el-button type="primary" @click="$router.push('/channel')" style="margin: 5px;">
              <el-icon><Connection /></el-icon>
              渠道管理
            </el-button>
            <el-button type="success" @click="$router.push('/distribution/scheme')" style="margin: 5px;">
              <el-icon><Share /></el-icon>
              分发方案
            </el-button>
            <el-button type="info" @click="$router.push('/engine/config')" style="margin: 5px;">
              <el-icon><DataLine /></el-icon>
              数据处理
            </el-button>
            <el-button type="warning" @click="$router.push('/monitor')" style="margin: 5px;">
              <el-icon><Monitor /></el-icon>
              数据监控
            </el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup lang="ts">
import { Connection, Share, DataLine, Monitor } from '@element-plus/icons-vue'
</script>

<style scoped>
.dashboard-container {
  padding: 20px;
}

.dashboard-card {
  margin-bottom: 20px;
}

.card-header {
  font-weight: bold;
  color: #303133;
}

.card-content {
  padding: 10px 0;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.stat-label {
  color: #909399;
  font-size: 14px;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #303133;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;